<?php 
	require('../db_connect.php');
	$sql = "SELECT realm_loc FROM realms WHERE realm_name='uofl_ekstrom'";
	$encoded_str_ekstrom = $db->Execute($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Small World Polygon Tool</title>
    <script type="text/javascript">
	(function(){function a(){this.t={};this.tick=function(c){this.t[c]=(new Date).getTime()};this.tick("start")}var b=new a;window.jstiming={Timer:a,load:b};if(window.external&&window.external.pageT)window.jstiming.pt=window.external.pageT;})();
	var _tocPath_ = '/html/apis/maps/documentation/_toc.ezt';
    </script>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo $gmaps_api_key; ?>" type="text/javascript"></script>
    <script src="http://swankestlabs.com/smallsmallworld/google_maps/maps_js/GToolPolyline.js" type="text/javascript"></script>
    <script src="http://swankestlabs.com/smallsmallworld/google_maps/maps_js/PolylineEncoder.js" type="text/javascript"></script>
    <script src="http://code.google.com/js/codesite.pack.01312008.js" type="text/javascript"></script>
    <script src="http://swankestlabs.com/smallsmallworld/jquery/jquery-1.2.6.min.js" type="text/javascript"></script>
    <script src="http://swankestlabs.com/smallsmallworld/google_maps/realm_tool.js" type="text/javascript"></script>	

    <style type="text/css">

    span.new {
      vertical-align: super;
      color: #cc0000;
      font-size: 70%;
    }

    .encodeBox {
      width: 550px;
      height: 40px;
      font-size: 14px;
      font-family: Courier;
    }

    .inputField {
      width: 160px;
    }

    #pointList {
      width: 300px;
      font-size: 12px;
    }

    #map_canvas {
      width: 350px;
      height: 300px;
      border: 1px solid gray;
      margin-top:6px;
    }

    #txtAddress {
      width: 14em;
    }

    </style>

    <script type="text/javascript">

    //<![CDATA[	


	function drawPolygon(encoded_points,encoded_levels){
	  var polygon = new GPolygon.fromEncoded({
	  polylines: [
	    {points: encoded_points,
	     levels: encoded_levels,
	     color: "#f33f00",
	     opacity: 0.7,
	     weight: 3,
	     numLevels: 18,
	     zoomFactor: 2}],
	  fill: true,
	  color: "#f33f00",
	  opacity: 0.4,
	  outline: true
	});

	map.addOverlay(polygon);
       }

    //]]>
    </script>
  </head>
  <body onload="onLoad()" onunload="GUnload()">

<table>
<tr valign="top">
<td>

  <form method="post" action="javascript:void(0)" onsubmit="centerMap()">
  Center map at: <input type="text" id="txtAddress"/>
  <input type="submit" value="Search"/>
  </form>
  <div id="map_canvas"></div>

</td>
<td style="padding-left:20px">

<table>
  <tr>
    <td align="right">Latitude:</td>
    <td><input id="txtLatitude" type="text" class="inputField"/></td>
  </tr>
  <tr>
    <td align="right">Longitude:</td>

    <td><input id="txtLongitude" type="text" class="inputField"/></td>
  </tr>
  <tr>
    <td align="right">Min zoom level:</td>
    <td><input id="txtLevel" type="text" size=3 value="3"/> <input type="button" value="Add Point" onclick="addPoint()"/></td>
  </tr>
  <tr>
    <td colspan=2 align="right">  
    </td>
  </tr>
</table>

<br />
<b>Point list</b><br />
<select id="pointList" size="14" onchange="highlight(this.selectedIndex)"
  ondblclick="jumpToPoint()"></select>
<br/>
<input type="button" value="Delete Selected Point" onclick="deletePoint()"/>
<input type="button" value="Delete All Points" onclick="deleteAllPoints()"/>

</td>
<td>
<div id="small_world_controls" style="height: 75px;width: 300px;display:block; border: 3px red solid;"><select id="realm_select" onchange="displayRealm()"></select><br/>
	<input type="button" value="delete realm from database" onclick="deleteRealm()"/> <br/>
	<a onclick="document.getElementById('small_world_display').innerHTML='test'"><span id="small_world_display">click me</span></a></div>
</td>
</tr>
<tr>

<td colspan=2>

<br />
<table>
  <tr>
    <td>Encoded Polyline:</td>
    <td>
<textarea id="encodedPolyline" class="encodeBox">
</textarea>
    </td>
  </tr>

  <tr>
    <td>Encoded Levels:</td>
    <td>
<textarea id="encodedLevels" class="encodeBox">
</textarea>
    </td>
  </tr>
  <tr>
    <td colspan=2 align="right">

      <input type="button" value="Decode Polyline and Levels" onclick="decode()"/>
    </td>
  </tr>
</table>

</td>
</tr>
<tr>

<div id="recordEntry">
<form action="realm_updater.php?query=add" method="post" target="_blank" id="post_form" onsubmit="execRealmUpdater()">
<input type="hidden" name="realm_loc" id="post_realm_loc" />
<input type="hidden" name="realm_level" id="post_realm_level"/>
<table>
<tr>
	<td> 
	realm type:
	</td>
	<td>
	<input type="text" name="realm_type"></textarea>
	</td>
</tr>
<tr>
	<td> 
	realm color:
	</td>
	<td>
	<input type="text" name="realm_color"></textarea>
	</td>
</tr>
<tr>
	<td> 
	realm name:
	</td>
	<td>
	<input type="text" name="realm_name"></textarea>
	</td>
</tr>
<tr>
	<td> 
	network id:
	</td>
	<td>
	<input type="text" name="network_id"></textarea>
	</td>
</tr>
<tr>
	<td> 
	parent realm:
	</td>
	<td>
	<input type="text" name="parent_realm"></textarea>
	</td>
</tr>
<tr>
	<td colspan=2>
	<input type="submit"/>
	</td>
</tr>
</table>
</div>

  </body>
</html>
